{include file="public/header" /}
<div class="page">
<div class="fixed-empty"></div>
  <form id="goods_class_form" name="goodsClassForm" method="post">
    <input type="hidden" name="fleaclass_id" value="{$class_array.fleaclass_id}" />
    <table class="ds-default-table">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label class="fleaclass_name validation">{$Think.lang.goods_class_index_name}:</label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform"><input type="text" value="{$class_array.fleaclass_name}" name="fleaclass_name" id="fleaclass_name" class="txt"></td>
            <td class="vatop tips">{$Think.lang.goods_class_index_name}</td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label>{$Think.lang.goods_class_index_display}:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform onoff"><label for="fleaclass_show1" class="cb-enable {if $class_array.fleaclass_show == '1'}selected{/if}"><span>{$Think.lang.ds_yes}</span></label>
            <label for="fleaclass_show0" class="cb-disable {if $class_array.fleaclass_show == '0'}selected{/if}"><span>{$Think.lang.ds_no}</span></label>
            <input id="fleaclass_show1" name="fleaclass_show" {if $class_array.fleaclass_show == '1'}checked="checked"{/if} value="1" type="radio">
            <input id="fleaclass_show0" name="fleaclass_show" {if $class_array.fleaclass_show == '0'}checked="checked"{/if} value="0" type="radio">
            </td>
          <td class="vatop tips">{$Think.lang.goods_class_add_display_tip}</td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label>{$Think.lang.goods_class_index_display_in_homepage}:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform onoff"><label for="fleaclass_index_show1" class="cb-enable {if $class_array.fleaclass_show == '1'}selected{/if}"><span>{$Think.lang.ds_yes}</span></label>
            <label for="fleaclass_index_show0" class="cb-disable {if $class_array.fleaclass_index_show == '0'}selected{/if}"><span>{$Think.lang.ds_no}</span></label>
            <input id="fleaclass_index_show1" name="fleaclass_index_show" {if $class_array.fleaclass_index_show == '1'}checked="checked"{/if} value="1" type="radio">
            <input id="fleaclass_index_show0" name="fleaclass_index_show" {if $class_array.fleaclass_index_show == '0'}checked="checked"{/if} value="0" type="radio"></td>
          <td class="vatop tips">{$Think.lang.goods_class_add_display_tip}</td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label for="fleaclass_sort">{$Think.lang.ds_sort}:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$class_array.fleaclass_sort}" name="fleaclass_sort" id="fleaclass_sort" class="txt"></td>
          <td class="vatop tips">{$Think.lang.goods_class_add_update_sort}</td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot"><td colspan="15" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
        </tr>
      </tfoot>
    </table>
  </form>

    </div>
{include file="public/footer" /}

<script>
$(document).ready(function(){
    $('#t_id').change(function(){
        if($(this).val() == '0'){
            $('#t_name').val('');
        }else{
            $('#t_name').val($(this).find('option:selected').text());
        }
    });

    $('#goods_class_form').validate({
        errorPlacement: function(error, element){
            error.appendTo(element.parent().parent().prev().find('td:first'));
        },

        rules : {
            fleaclass_name : {
                required : true,
                remote   : {
                    url :"{:url('Fleaclass/ajax',['branch'=>'check_class_name'])}",
                    type:'get',
                    data:{
                        fleaclass_name : function(){
                            return $('#fleaclass_name').val();
                        },
                        fleaclass_parent_id : function() {
                            return $('#fleaclass_parent_id').val();
                        },
                        fleaclass_id : '{$class_array.fleaclass_id}'
                    }
                }
            },
            fleaclass_sort : {
                number   : true
            }
        },
        messages : {
            fleaclass_name : {
                required : '{$Think.lang.goods_class_add_name_null}',
                remote   : '{$Think.lang.goods_class_add_name_exists}'
            },
            fleaclass_sort  : {
                number   : '{$Think.lang.goods_class_add_sort_int}'
            }
        }
    });
});
</script>